package com.ivr.cm.monitor;

import java.io.OutputStream;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.ivr.cm.dao.IMonitorDao;
import com.ivr.cm.util.SpringServiceUtil;

/**
 * 数据库连接监控
 * @author liugeng
 *
 */
public class MonitorServlet implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		IMonitorDao monitordao = (IMonitorDao)SpringServiceUtil.getService("monitorDao");
		String resp = monitordao.checkConnetDB();
		
		OutputStream os = response.getOutputStream();
		os.write(resp.getBytes());
		os.flush();
		os.close();
		
		return null;
	}
}